/**   
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2020-03-25 21:12:01  
 * Copyright (c) 2015- -版权所有     
 */

package com.joysuch.wwyt.bp.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_bp_industrial_injure_apply")
@SQLDelete(sql = "update wwyt_bp_industrial_injure_apply set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_industrial_injure_apply set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
public class BpIndustrialInjureApply implements java.io.Serializable {

    // columns START
    @Id
    @GeneratedValue(strategy = IDENTITY)

    // ID
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    // 事故ID
    @Column(name = "ACCIDENT_ID", nullable = false)
    private Long accidentId;

    // 申报人
    @Column(name = "APPLY_USER_ID", nullable = false)
    private Long applyUserId;

    // 申报人姓名
    @Column(name = "APPLY_USER_NAME", length = 12)
    private String applyUserName;

    // 申报人性别
    @Column(name = "APPLY_USER_SEX", length = 1, nullable = false)
    private String applyUserSex;

    // 申报人部门ID
    @Column(name = "APPLY_USER_DEPART_ID", nullable = false)
    private Long applyUserDepartId;

    // 申报人部门名称
    @Column(name = "APPLY_USER_DEPART_NAME", length = 200)
    private String applyUserDepartName;

    // 申报时间
    @Column(name = "APPLY_TIME", nullable = false)
    private java.util.Date applyTime;

    // 上报时间
    @Column(name = "REPORT_TIME", nullable = false)
    private java.util.Date reportTime;

    // 工伤类型
    @Column(name = "INJURY_TYPE", nullable = false)
    private Long injuryType;

    // 损失工时
    @Column(name = "WORK_TIME_LOSS", nullable = false)
    private Integer workTimeLoss;

    // 就诊医院
    @Column(name = "HOSPITAL", length = 100, nullable = false)
    private String hospital;

    // 就诊结果
    @Column(name = "DOCTOR_RESULT", length = 500, nullable = false)
    private String doctorResult;

    // 注意事项
    @Column(name = "ATTENDTION_MATTERS", length = 65535)
    private String attendtionMatters;

    // 备注
    @Column(name = "REMARK", length = 65535)
    private String remark;

    // 附件ID
    @Column(name = "ATTACHMENT_ID")
    private Long attachmentId;

    // 材料是否齐全
    @Column(name = "ALL_MATERIAL_OK", length = 2, nullable = false)
    private String allMaterialOk;

    // 状态
    @Column(name = "STATE")
    private Byte state;

    // 创建人
    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    private Long createBy;

    // 创建时间
    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    private java.util.Date createTime;

    // 更新人
    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    private Long updateBy;

    // 更新时间
    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    private java.util.Date updateTime;

    // 删除标记
    @Column(name = "DELETE_FLAG", length = 2)
    private String deleteFlag;

    // 组织机构代码
    @Column(name = "ORG_CODE", length = 100)
    private String orgCode;

    // 租户
    @Column(name = "TENENT_ID")
    private Long tenentId;
    // columns END

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BpIndustrialInjureApply == false)
            return false;
        if (this == obj)
            return true;
        BpIndustrialInjureApply other = (BpIndustrialInjureApply) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
